package com.esisa.utils;

import com.esisa.business.AdminManager;
import com.esisa.business.AuthentificationManager;
import com.esisa.business.DefaultAdminManager;
import com.esisa.business.DefaultAuthentificationManager;
import com.esisa.business.DefaultFermierManager;
import com.esisa.business.DefaultVeterinaireManager;
import com.esisa.business.FermierManager;
import com.esisa.business.VeterinaireManager;
import com.esisa.dao.BetailDao;
import com.esisa.dao.CompteDao;
import com.esisa.dao.FermierDao;
import com.esisa.dao.TypeBetailDao;
import com.esisa.dao.VeterinaireDao;
import com.esisa.dao.hibernate.BetailDaoHibernate;
import com.esisa.dao.hibernate.CompteDaoHibernate;
import com.esisa.dao.hibernate.FermierDaoHibernate;
import com.esisa.dao.hibernate.TypeBetailDaoHibernate;
import com.esisa.dao.hibernate.VeterinaireDaoHibernate;
import com.esisa.models.TypeBetail;

public class BusinessFactory {
	private static AuthentificationManager authentificationManager;
	private static VeterinaireManager veterinaireManager;
	private static AdminManager adminManager;
	private static FermierManager fermierManager;
	static{
		CompteDao compteDao=new CompteDaoHibernate();
		VeterinaireDao veterinaireDao=new VeterinaireDaoHibernate();
		TypeBetailDao typeBetailDao=new TypeBetailDaoHibernate();
		FermierDao fermierDao=new FermierDaoHibernate();
		
		authentificationManager=new DefaultAuthentificationManager();
		((DefaultAuthentificationManager)authentificationManager).setCompteDao(compteDao);
		
		veterinaireManager=new DefaultVeterinaireManager();
		((DefaultVeterinaireManager)veterinaireManager).setCompteDao(compteDao);
		((DefaultVeterinaireManager)veterinaireManager).setVeterinaireDao(veterinaireDao);
		
		adminManager=new DefaultAdminManager();
		((DefaultAdminManager)adminManager).setTypeBetailDao(typeBetailDao);
		
		fermierManager=new DefaultFermierManager();
		((DefaultFermierManager)fermierManager).setFermierDao(fermierDao);
		((DefaultFermierManager)fermierManager).setCompteDao(compteDao);
	}
	public static AuthentificationManager getAuthentificationManager() {
		return authentificationManager;
	}
	public static VeterinaireManager getVeterinaireManager() {
		return veterinaireManager;
	}
	public static AdminManager getAdminManager() {
		return adminManager;
	}
	public static FermierManager getFermierManager() {
		return fermierManager;
	}
	
	
}	
